<template>
  <div id="printJS-form" class="c-org-print">
    <table border="1" width="900" align="center" cellspacing="0" cellpadding="6">
      <caption>组织表</caption>
      <thead>
        <tr align="center">
          <th>组织编码</th>
          <th>组织名称</th>
          <th>统一社会信用码</th>
          <th>行业属性</th>
          <th>组织类型</th>
          <th>所属组织单元</th>
          <th>单位负责人</th>
          <th>联系电话</th>
        </tr>
      </thead>

      <tbody>
        <tr
          v-for="item in printData"
          :key="item.phid"
          align="center"
        >
          <td>{{ item.encode }}</td>
          <td>{{ item.name }}</td>
          <td>{{ item.enterpriseCode }}</td>
          <td>
            {{ item.tradeType != null ? tradeTypeList.find(i => i.encode == item.tradeType ).name:'' }}
          </td>
          <td>
            {{ item.type?typeList.find(i => i.encode ==item.type).name:'' }}
          </td>
          <td>{{ item.orgGroupName }}</td>
          <td>{{ item.manager }}</td>
          <td>{{ item.managerMobile }}</td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script>
export default {
  props: {
    printData: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      tradeTypeList: [
        { encode: 0, name: '行政单位' },
        { encode: 1, name: '事业单位' },
        { encode: 2, name: '村集体经济组织' },
        { encode: 3, name: '其他' }
      ],
      typeList: [
        { encode: '0', name: '常用组织' },
        { encode: '1', name: '总预算组织' },
        { encode: '2', name: '支付中心组织' },
        { encode: '3', name: '统管组织' }
      ],
      organizationColumn: [
        {
          label: '组织编码',
          prop: 'encode',
          width: 150
        },
        {
          label: '组织名称',
          prop: 'name',
          width: 120
        },
        {
          label: '统一社会信用社代码',
          prop: 'enterpriseCode',
          minWidth: 240
        },
        {
          label: '行业属性',
          prop: 'tradeType',
          width: 120
        },
        {
          label: '组织类型',
          prop: 'type',
          width: 120
        },
        {
          label: '所属组织单元',
          prop: 'orgGroupName',
          minWidth: 240
        },
        {
          label: '单位负责人',
          prop: 'manager',
          width: 120
        },
        {
          label: '联系电话',
          prop: 'managerMobile',
          width: 120
        }
      ]
    }
  }
}
</script>

<style lang="scss" scoped>
  .c-org-print {
    transform: translate3d(9999px, 9999px, 1px);
    visibility: hidden;
    height: 100%;
    visibility: hidden;
    position: fixed;
    left: 0;
    top: 0;
    .print-table {
      width: 900px;
      text-align: left;
      th {
        text-align: left!important;
      }
    }
  }
</style>
